<!DOCTYPE html>
<html>
<script>
function runTest()
{
    if (window.testRunner) {
        testRunner.waitUntilDone();
        testRunner.dumpAsText();
        document.querySelector('iframe').onload = function () { testRunner.notifyDone(); };
    }
    window[0].onbeforeunload = function() { window[0].document.write("<script>alert('hello world!');</scr" + "ipt>"); }
    window[0].location = 'data:text/plain,Done!';
}
</script>
<body onload="runTest()">
<p>Test that alert() inside a document.write() during a beforeunload handler does not confuse the modal dialog blocker. This test passes if no alert() dialogs are seen.
<iframe>
</iframe>
</body>
</html>
